package minuy.android.slowcarremotecontrol.tool;

import android.os.Handler;
import android.os.Message;


public class HanderHelper {
    private Handler handler;
    static private HanderHelper handerHelper;
    private HanderHelper(){}
    public void setHander(Handler hander){
        this.handler = hander;
    }

    public static HanderHelper getHanderHelper(){
        if(handerHelper==null){
            handerHelper = new HanderHelper();
        }
        return handerHelper;
    }

    public void sendHanderMsg(int what,int arg){
        sendHanderMsg(what,0,null);
    }
    public void sendHanderMsg(int what){
        sendHanderMsg(what,0);
    }
    public void sendHanderMsg(int what,Object obj){
        sendHanderMsg(what,0,obj);
    }
    public void sendHanderMsg(int what,int arg,Object obj){
        Message msg = new Message();
        msg.what = what;
        msg.arg1 = arg;
        msg.obj = obj;
        handler.sendMessage(msg);
    }
}
